﻿<UserControl x:Class="Sovacode.DemoApp.View.SimpleValidationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="250"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <ListView Grid.Column="0" ItemsSource="{Binding DataObjects}" ItemTemplate="{StaticResource SimpleData}" SelectedItem="{Binding Path=SelectedDataObject, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5,5,0,5"/>

        <StackPanel Grid.Column="1" Orientation="Vertical">
            <TextBlock Text="Name:" Margin="10,5,10,0"/>
            <TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Margin="10,5,10,0" Height="23" VerticalContentAlignment="Center"/>
            <Button Content="_Create New" Margin="10,5,10,0" Command="{Binding [CreateNewDataObject]}" Height="23" Width="250" HorizontalAlignment="Left"/>
            <Button Content="_Save Selected" Margin="10,5,10,0" Command="{Binding [SaveOldDataObject]}" Height="23" Width="250" HorizontalAlignment="Left"/>
            <Button Content="_Remove Selected" Margin="10,5,10,0" Command="{Binding [RemoveOldDataObject]}" Height="23" Width="250" HorizontalAlignment="Left"/>
            <Button Content="Clear _All" Margin="10,5,10,0" Command="{Binding [ClearAll]}" Height="23" Width="250" HorizontalAlignment="Left"/>
            
        </StackPanel>

    </Grid>
</UserControl>
